﻿using System;
using System.Collections.Generic;
using System.Text;
using XhPaper.基本图形;

namespace XhPaper
{
    public class MyTableJdqMini : MyTableBase
    {
        string[] str = new string[] { "+12V", "GND", "485+", "485-" };
        MyDuanZi m_dz1;
        public MyDuanZi Dz1
        {
            get { return m_dz1; }
            set { m_dz1 = value; }
        }
        MyDuanZi m_dz2;
        public MyDuanZi Dz2
        {
            get { return m_dz2; }
            set { m_dz2 = value; }
        }
        public MyTableJdqMini()
        {

        }
        public MyTableJdqMini(double left, double top, MyAutoCadObjectBase container,bool isdyhx=true)
            :base(left + container.Left, container.Top+top, container)
        {
            ITable = new XmlTableJdqMini();
            m_HangLines = ITable.GetHangLines(this);
            m_LieLines = ITable.GetLieLines(this);
            ITable.GetNameTextDic(this, out m_TableNameDic, out m_TableTextDic);
            MyPoint p1 = m_HangLines[1].P1.inflate(4, -14);
            MyPoint p2 = m_HangLines[1].P1.inflate(4, -24);
            MyText text;
            string str1,str2;
            if(isdyhx)
            {
                str1 = str[0];
                str2 = str[1];
            }
            else
            {
                str1 = str[2];
                str2 = str[3];
            }
            text = new MyText(p1, str1, this);
            Dz1 = new MyDuanZi(p1, text, this);
            text = new MyText(p2, str2, this);
            Dz2 = new MyDuanZi(p2, text, this);
        }
        public MyTableJdqMini(double left, double top, MyAutoCadObjectBase container,string[] str)
            : base(left + container.Left, container.Top + top, container)
        {
            ITable = new XmlTableJdqMini();
            m_HangLines = ITable.GetHangLines(this);
            m_LieLines = ITable.GetLieLines(this);
            ITable.GetNameTextDic(this, out m_TableNameDic, out m_TableTextDic);
            MyPoint p1 = m_HangLines[1].P1.inflate(4, -14);
            MyPoint p2 = m_HangLines[1].P1.inflate(4, -24);
            MyText text;
            text = new MyText(p1, str[0], this);
            Dz1 = new MyDuanZi(p1, text, this);
            text = new MyText(p2, str[1], this);
            Dz2 = new MyDuanZi(p2, text, this);
        }
        public override void MyDraw(MyCadDll.MyCad mycad)
        {
            base.MyDraw(mycad);
            Dz1.MyDraw(mycad);
            Dz2.MyDraw(mycad);
        }
    }
}
